package com.jiangyg.mall.core.exception;

import com.jiangyg.mall.core.utils.I18n;

/**
 * 类描述：自定义业务异常
 *
 * @author jiangyg
 * @version 4.0
 * @date 2021-10-15
 */
public class BusinessException extends RuntimeException {

    private static final long serialVersionUID = -547772298429090735L;

    public static BusinessException instance(String key) {
        return new BusinessException(I18n.getString(key));
    }

    public static BusinessException instance(String key, Object... vals) {
        return new BusinessException(I18n.getString(key, vals));
    }

    public BusinessException(String message) {
        super(message);
    }

    /**
     * 功能描述：不写入堆栈信息，提高性能
     *
     * @return 结果
     */
    @Override
    public Throwable fillInStackTrace() {
        return this;
    }

}
